package com.example.tass.controller;

import cn.tass.SRJ1933.devices.inf.TassSignServerApi;
import cn.tass.exceptions.TAException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

//@Component
public class InitServer_3_1 {
    

    private static TassSignServerApi signServerApi;
    
    public static TassSignServerApi getSignServerApi(){
        
        System.out.println("*********** 设备开始初始化... *********** ");
        try {
            //signServerApi = TassSignServerApi.init("config/cfg.ini");
            String config =
                    "{"
                            + "[LOGGER];"
                            + "logsw=error;logPath=./;"
                            + "[HOST 1];"
                            + "hsmModel=SRJ1933;"
                            + "linkNum=-15;"
                            + "host=192.168.2.62;"
                            + "port=9081;"
                            + "connTimeout=10;"
                            + "sysname=app2;"
                            + "signkey=1771f37B;"
                            + "}";
            signServerApi = TassSignServerApi.init(config);
            if (null == signServerApi) {
                System.err.println("初始化失败....");
            }
        } catch (TAException e) {
            System.err.println("初始化失败...");
            e.printStackTrace();
        }
        return signServerApi;
    }
}
